Page({
  data:{
    isFinish:false
  },
  onLoad({id}){
   this.getPassport(id)
  },
  async getPassport(id){
   const {code,data} = await wx.http.get(`/visitor/${id}`)
   if(code !== 10000) return wx.utils.toast()
   this.setData({
    ...data
   })
  },
  countDownFinish(){
    this.setData({
      isFinish:true
    })
  },
  onShareAppMessage(){
    return{
      title: '查看通行证',
      path: '/visitor_pkg/pages/passport/index',
      imageUrl: 'https://enjoy-plus.oss-cn-beijing.aliyuncs.com/images/share_poster.png'
    }
  },
  async saveImg(){
    const res = await wx.getImageInfo({
      src:this.data.url
    })
    console.log(res)
    wx.saveImageToPhotosAlbum({
      filePath: res.path
    })
  }
})
  